<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){

	condition();
	
	$('#merNo').autocomplete({
	    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
	    	minChars:1,
	    	paramName:'merNo',
	    	transformResult: function(response) {
    		　　return {
    		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
    		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
    		　　　　})
    		　　};
    		},
	    	formatResult:function (suggestion, currentValue) {
	    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
	    	}
	});
	
	$('#merVm').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/bank_auto.html',
    	minChars:1,
    	paramName:'bnkNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.bnkNo, data: dataItem.bnkName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});	
	
	$('#merVs').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/bank_auto.html',
    	minChars:1,
    	paramName:'bnkNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.bnkNo, data: dataItem.bnkName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});
	
	$('#merMm').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/bank_auto.html',
    	minChars:1,
    	paramName:'bnkNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.bnkNo, data: dataItem.bnkName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});
	
	$('#merMs').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/bank_auto.html',
    	minChars:1,
    	paramName:'bnkNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.bnkNo, data: dataItem.bnkName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});
	
	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

function condition(){
	if($("#high").prop("checked")){
		$(".ac").show();
	}else{
		$(".ac").hide();
	}
}
</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="merchant_listbank.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="25" >
	<b>操作说明:商户名称支持模糊查询</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield name="merNo" id="merNo" placeholder="商户编号"></s:textfield>
<s:textfield name="merName" id="merName" placeholder="商户名称"></s:textfield>
<s:select id="merState" name="merState" list="#{'1':'正常','0':'关闭'}" headerKey="" headerValue="状态"/>
<s:textfield  id="merDateTop"  name="merDateTop" placeholder="登记日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="merDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="merDateEnd"  name="merDateEnd" placeholder="登记日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="merDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>


<input type="button" class="submit" value="提交查询" onclick="sform.submit();"/>
<input type="button" class="submit" value="高级搜索" onclick="$('#high').click();"/>
<s:checkbox id="high" name="high"  onclick="condition();" cssStyle="display:none;"></s:checkbox></td>
</tr>
<tr><td><hr/></td></tr>
<tr class="ac" style="display: none;"><td height="30" >
<s:textfield name="merVm" id="merVm" placeholder="V卡主通道"></s:textfield>
<s:textfield name="merVs" id="merVs" placeholder="V卡备通道"></s:textfield>
<s:textfield name="merMm" id="merMm" placeholder="M卡主通道"></s:textfield>
<s:textfield name="merMs" id="merMs" placeholder="M卡备通道"></s:textfield>
</td>
</tr>
<tr class="ac"  style="display: none;"><td><hr/></td></tr>
<tr >
<td height="30" >
	<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit" value="编号排序" onclick="toSort('sortField','merNo')"/>
		<input type="button" class="submit" value="日期排序" onclick="toSort('sortField','merDate')"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
</div>

	<table id="dataTable" style="width: 100%;" class="easyui-datagrid">
		<thead>
			<tr>
				<th data-options="field:'ck'" checkbox="true"></th>
				<th data-options="field:'merNo', width:'8%',align:'left' , halign: 'left'">商户编号</th>
				<th data-options="field:'merVe', width:'3%',align:'left' , halign: 'left'">V主</th>
				<th data-options="field:'merVm', width:'8%',align:'left' , halign: 'left'">收单行</th>
				<th data-options="field:'merVb', width:'3%',align:'left' , halign: 'left'">V备</th>
				<th data-options="field:'merVs', width:'8%',align:'left' , halign: 'left'">收单行</th>
				<th data-options="field:'merVp', width:'4%',align:'left' , halign: 'left'">V佣金</th>
				<th data-options="field:'merVd', width:'4%',align:'left' , halign: 'left'">V押金</th>
				<th data-options="field:'merMe', width:'3%',align:'left' , halign: 'left'">M主</th>
				<th data-options="field:'merMm', width:'8%',align:'left' , halign: 'left'">收单行</th>
				<th data-options="field:'merMb', width:'3%',align:'left' , halign: 'left'">M备</th>
				<th data-options="field:'merMs', width:'8%',align:'left' , halign: 'left'">收单行</th>
				<th data-options="field:'merMp', width:'4%',align:'left' , halign: 'left'">M佣金</th>
				<th data-options="field:'merMd', width:'4%',align:'left' , halign: 'left'">M押金</th>
				<th data-options="field:'merState', width:'6%',align:'left' , halign: 'left'">状态</th>
				<th data-options="field:'merDate', width:'12%',align:'left' , halign: 'left'">登记日期</th>
				<th data-options="field:'op', width:'100',align:'left' , halign: 'left'">操作</th>

			</tr>
		</thead>
		<tbody>
			<s:iterator value="merchantList" id="show" status="seq">
				<tr>
					<td><s:property value="#show.merNo" /></td>
					<td><s:property value="#show.merNo" /></td>
					<td><s:if test="#show.merVe==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
					<td><a href="<%=request.getContextPath()%>/bank_show.html?bnkNo=<s:property value="#show.merVm"/>"><s:property value="#show.merVm"/></a></td>
					<td><s:if test="#show.merVb==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
					<td><a href="<%=request.getContextPath()%>/bank_show.html?bnkNo=<s:property value="#show.merVs"/>"><s:property value="#show.merVs"/></a></td>
					<td><s:text name="global.format.count"><s:param value="#show.merVp"/></s:text>%</td>
					<td><s:text name="global.format.count"><s:param value="#show.merVd"/></s:text>%</td>
					<td><s:if test="#show.merMe==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
					<td><a href="<%=request.getContextPath()%>/bank_show.html?bnkNo=<s:property value="#show.merMm"/>"><s:property value="#show.merMm"/></a></td>
					<td><s:if test="#show.merMb==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
					<td><a href="<%=request.getContextPath()%>/bank_show.html?bnkNo=<s:property value="#show.merMs"/>"><s:property value="#show.merMs"/></a></td>
					<td><s:text name="global.format.count"><s:param value="#show.merMp"/></s:text>%</td>
					<td><s:text name="global.format.count"><s:param value="#show.merMd"/></s:text>%</td>
					<td><s:if test="#show.merState==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
					<td><s:text name="global.format.dateminute"><s:param value="#show.merDate"/></s:text></td>
					<td>
						<input type="button" value="详情" style="width: 50px;" class="submit" onclick="location.href='<%=request.getContextPath()%>/merchant_show.html?merNo=<s:property value="#show.merNo"/>'" />
						<input type="button" value="修改" style="width: 50px;" class="submit" onclick="location.href='<%=request.getContextPath()%>/merchant_editbank.html?merNo=<s:property value="#show.merNo"/>'" />
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<br />
	<br />
	<br />
</body>
</html>
